package com.doyens.mapper;

import com.doyens.pojo.Student;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface StudentMapper {
    /**
     * 查询学生表
     */
    @Select("select * from student")
    List<Student> findAllStu();

    @Select("select * from student where id=#{id}")
    Student findById(Integer id);

    @Delete("delete from student where id=#{id}")
    int delete(Integer id);

    @Insert("insert into student values (null,#{sname},#{age},#{gender},#{phoneNum},#{size},#{addr},#{height})")
    int save(Student student);

    @Update("update student set sname=#{sname},age=#{age},gender=#{gender},phoneNum=#{phoneNum},size=#{size},addr=#{addr},height=#{height} where id=#{id}")
    Integer update(Student student);
}
